use std::ops::Add;

struct Solution {}

fn main() {}

impl Solution {
    pub fn convert_to_title(column_number: i32) -> String {
        let s1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ";
        let mut ret = String::new();
        let mut n1 = column_number;
        while n1 > 0 {
            let ys = n1 % 26;
            let idx = n1 % 26 + 26 - 1;
            ret = ret.clone().add(&s1[(idx) as usize..(idx + 1) as usize]);
            if ys == 0 {
                n1 -= 26;
            }
            n1 -= ys;
            n1 /= 26;
        }
        ret.chars().rev().collect()
    }
}